<div class="forum-path"> 
<?php echo $this->Html->link('Project', array('controller' => 'projects', 'action' => 'view',$projectId)); ?> » 
<?php echo $this->Html->link('Forum index', array('controller' => 'forums', 'action' => 'index',$projectId)); ?> » 
<?php echo $this->Html->link($forumName, array('controller' => 'forums', 'action' => 'view', $forumId)); ?> 
</div>
<h3><?php echo $topic['ForumTopic']['subject'] ?></h3>
<div class="forum-index">
   <table class="table table-bordered">
    <thead>
    <tr style="
        background-color: rgba(44, 43, 43, 0.79);
        color: whitesmoke;
    ">
        <th style="text-align:center">Author</th>
        <th colspan="5" style="text-align:center">Message</th>
    </tr>
    </thead>
    <tbody>
    
    <?php foreach ($posts as $post): ?>
    <tr>
    	<a name="<?php echo $post['ForumPost']['id']; ?>" id="<?php echo $post['ForumPost']['id']; ?>"></a>
      <td class="leftalign"><?php echo $this->Html->link($post['User']['username'], 
					array('controller' => 'users', 'action' => 'view', $post['User']['id'])); ?></td>
      <td class="leftalign">
      <?php if($post['User']['id'] == AuthComponent::user('id')): ?>
	  	<div class="forum-topic-cp">
        	<?php echo $this->Html->link('Edit', 
						array('controller' => 'forums', 'action' => 'editpost', $post['ForumPost']['id'], $topicId, $forumId)); ?> |
            <?php echo $this->Html->link('Delete', 
						array('controller' => 'forums', 'action' => 'deletepost', $post['ForumPost']['id'], $topicId, $forumId)); ?>
         <?php endif; ?>
        </div>
	  	<?php echo $post['ForumPost']['text']; ?>
        <div class="forum-topic-date">
        	<span>ID: <?php echo $post['ForumPost']['id']; ?></span>
        	Date: <?php echo $this->Time->format('d.m.Y H:i',$post['ForumPost']['created']); ?>
        </div>
      </td>
    </tr>
    <?php endforeach; ?>
     </tbody>
  </table>
</div>
<div class="paging">
  <?php 
		$this->Paginator->options(array('url' => $this->passedArgs,));
		echo $this->Paginator->prev("« back", array(), null, array('class'=>'disabled'));
		echo $this->Paginator->numbers(array('before' => '', 'after' => '', 'separator' => ''));
		echo $this->Paginator->next('forward »', array(), null, array('class'=>'disabled'));
	?>
</div>
<p align="right">
<?php echo $this->Html->link('New topic', array('controller' => 'forums', 'action' => 'newtopic', $forumId),array('class'=>'btn btn-inverse')); ?>
<?php echo $this->Html->link('Post reply', array('controller' => 'forums', 'action' => 'reply', $topicId, $forumId),array('class'=>'btn btn-inverse','style'=>'margin-left:10px;')); ?>
</p>
